#include "nofocusitemdelegate.h"

NoFocusItemDelegate::NoFocusItemDelegate(QObject* parent) : QStyledItemDelegate(parent) { }

void NoFocusItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
                                const QModelIndex& index) const
{
    if (option.state & QStyle::State_HasFocus) {
        QStyleOptionViewItem option2(option);
        option2.state &= ~QStyle::State_HasFocus;
        QStyledItemDelegate::paint(painter, option2, index);
    } else {
        QStyledItemDelegate::paint(painter, option, index);
    }
}
